package list;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

/**
 * @author
 * @Title: TestSplitList
 * @Description:
 * @date 2022/6/16 11:40 上午
 */
public class TestPartitionList {

    /**
     * 使用guava对list进行分片处理
     */
    @Test
    public void test01(){
        List<String> list = Arrays.asList("1", "2", "3", "4", "5", "6", "7");
        List<List<String>> partition = Lists.partition(list, 2);
        for (List<String> e:partition) {
            System.out.println(e.size());
        }
    }

}
